package org.example.thread.testSequence;

/**
 * @author liyishan
 * @date 2024/7/16 14:55
 * @apiNote
 */

public class TestTread extends Thread{
    private Thread beforeThread;
    private String str;
    public TestTread(Thread beforeThread, String str) {
        this.beforeThread = beforeThread;
        this.str = str;
    }

    @Override
    public void run() {
        if(beforeThread != null){
            try{
                beforeThread.join();
            }catch(Exception e){
                e.printStackTrace();
            }
        }
        System.out.println(str);
    }
}
